package org.example.sunrise.models;

import javafx.scene.image.Image;
import org.example.sunrise.core.Cache;

import java.util.Objects;

public class LocalImageModel extends Cache<LocalImageModel.ImageKey, Image> {
    @Override
    public Image apply(ImageKey imageKey) {
        return new Image(Objects.requireNonNull(imageKey.clazz.getResource(imageKey.path)).toString(), imageKey.width, imageKey.height, false, false);
    }

    public record ImageKey(String path, double width, double height, Class<?> clazz) {
    }
}
